home *** CD-ROM | disk | FTP | other *** search
/ Trusted Irix /B 4.0.4 / Trusted-Irix B-4.0.1.iso / dist / eoe1.idb / usr / include / sys / mp_gio.h.z / mp_gio.h
C/C++ Source or Header  |  1992-04-03  |  5KB  |  146 lines

  1. #ifndef __SYS_MP_GIO_H__
  2. #define __SYS_MP_GIO_H__
  3.  
  4. /*
  5.  *  $Revision: 1.12 $
  6.  *
  7.  *  Description of address spaces for the MP bus to GIO bus adapter.
  8.  *
  9.  *  All the local registers of the MP_GIO adapter are mapped to MP
  10.  *  slot 0xc.
  11.  *
  12.  */
  13.  
  14.  
  15. #define MG1_REGISTERS_SIZE        0x1000        /* 1 page of adapter registers */
  16. #define MG1_3WAY_CMD_MAPPER_SIZE    0x20000        /* 128Kb or 32Kwords */
  17. #define MG1_PROM_SIZE            0x80000        /* 128 pages with each word containing only one valid byte*/
  18. #define GIO_SIZE            0x400000    /* 4Mb GIO space */
  19. #define IP17_3WAY_SIZE            0x2000        /* 2 pages */
  20.  
  21.  
  22. /*
  23.  * Adapter control register 1 bit masks.
  24.  */
  25. #define MG1_CTL1_DUALHD            (0x1<<0)    /* set to 1 for head 1, 0 for head 0 */
  26. #define MG1_CTL1_FIFO_RDISABLE         (0x1<<1)    /* Fifo read disable */
  27. #define MG1_CTL1_CMDMAP_ACCESS         (0x1<<2)    /* Command Mapper Access mode */
  28. #define MG1_CTL1_RST_GIO        (0x1<<3)    /* 0 to reset GIO bus */
  29. #define MG1_CTL1_RST_ADP        (0x1<<4)    /* 0 to reset adapter */
  30. #define MG1_CTL1_DIAG_MODE        (0x1<<5)    /* diag mode bit */
  31. #define MG1_CTL1_FIFO_CTL        (0x1<<6)    /* fifo control (set to 1 slight before, during, and slight after reset) */
  32. #define MG1_CTL1_NOT_YET_DEF        (0x1<<7)
  33. #define MG1_CTL1_FAF_IE            (0x1<<8)    /* fifo almost full interrupt enable */
  34. #define MG1_CTL1_VRI_IE            (0x1<<9)    /* vertical retrace interrupt enable */
  35. #define MG1_CTL1_GFX_IE            (0x1<<10)    /* GFX interrupt enable */
  36. #define MG1_CTL1_VII_IE            (0x1<<11)    /* Video interrupt enable */
  37. #define MG1_CTL1_VSTAT_IE        (0x1<<12)    /* GFX Vstat interrupt enable */
  38. #define MG1_CTL1_LE            (0x1<<13)    /* 1 for little endian host */
  39. #define MG1_CTL1_DBL_R            (0x1<<14)    /* Double word read PIO */
  40. #define MG1_CTL1_ADPFIFO_BYP        (0x1<<15)    /* 1 to bypass adapter fifo */
  41.  
  42.  
  43. /*
  44.  * Adapter control register 2 bit masks.
  45.  */
  46. #define MG1_CTL2_3WAY_B            (0x1<<0)    /* 3way type B */
  47. #define MG1_CTL2_DIAG_STRT        (0x1<<1)    /* diagnostic start */
  48. #define MG1_CTL2_DIAG0            (0x1<<2)    /* diag command number 0 */
  49. #define MG1_CTL2_DIAG1            (0x1<<3)    /* diag command number 1 */
  50. #define MG1_CTL2_STATIC_0_OFFSET    (0x1<<4)
  51. #define MG1_CTL2_STATIC_1_OFFSET    (0x1<<5)
  52.  
  53.  
  54. /*
  55.  * Adapter status register bit masks.
  56.  */
  57. #define MG1_STAT_GFXDLY            (0x1<<0)    /* Graphics delay */
  58. #define MG1_STAT_FREQ            (0x1<<1)    /* 0 means 25MHz, 1 means 33Mhz GIO bus */
  59. #define MG1_STAT_GIO_FF            (0x1<<2)    /* GIO fifo full */
  60. #define MG1_STAT_GIO_VRI        (0x1<<3)    /* GIO vert retrace interrupt */
  61. #define MG1_STAT_GIO_VII        (0x1<<4)    /* GIO video interrupt */
  62. #define MG1_STAT_GIO_GEI        (0x1<<5)    /* GIO GE interrupt */
  63. #define MG1_STAT_GIO_VSTAT        (0x1<<6)    /* GIO VSTAT */
  64. #define MG1_STAT_VVF            (0x1<<7)    /* Video VField */
  65. #define MG1_STAT_DMASYNC        (0x1<<8)    /* GFX DMA sync */
  66. #define MG1_STAT_ADP_FF            (0x1<<9)    /* Adapter fifo full (active hi)*/
  67. /* bit 10 unused currently */
  68. #define MG1_STAT_ADP_FAF        (0x1<<11)    /* Adapter fifo almost full (active hi)*/
  69. #define MG1_STAT_ADP_FAE        (0x1<<12)    /* Adapter fifo almost empty (active hi)*/
  70. #define MG1_STAT_ADP_FE            (0x1<<13)    /* Adapter fifo empty (active low)*/
  71. #define MG1_STAT_DIAG_DONE        (0x1<<14)    /* diag complete */
  72. #define MG1_STAT_WRBYP_DONE        (0x1<<15)
  73.  
  74.  
  75. #ifdef LANGUAGE_C
  76. struct mg1_regs {
  77.     volatile unsigned long    id;        /* ID register */
  78.     volatile unsigned long    status;        /* Status register */
  79.     volatile unsigned long    control1;    /* Control register 1*/
  80.     volatile unsigned long    control2;    /* Control register 2*/
  81.     volatile unsigned long    upperGIOaddr;    /* Upper GIO address */
  82.     volatile unsigned long    fifo_control;    /* fifo control register */
  83. };
  84. #endif /* LANGUAGE_C */
  85.  
  86.  
  87.  
  88. #ifdef _KERNEL
  89.  
  90.  
  91. /* physical addresses of various MG1 hardware */
  92. #define MG1_REGISTERS        0x17000000    /* Beginning of adapter registers */
  93. #define MG1_3WAY_CMD_MAPPER    0x17020000    /* to 0x1703ffff */
  94. #define MG1_PROM        0x17200000    /* Read only    */
  95.  
  96. /* physical addresses of local registers */
  97. #define    MG1_ID        0x17000000    /* Read only    */
  98. #define MG1_STATUS    0x17000004    /* Read only    */
  99. #define MG1_CONTROL1    0x17000008    /* RW        */
  100. #define MG1_CONTROL2    0x1700000c    /* RW        */
  101. #define MG1_UPPER_GIO    0x17000010    /* RW        */
  102. #define MG1_FIFO_CTL    0x17000014    /* RW        */
  103.  
  104. /*
  105.  * macro that converts GIO physical addresses into
  106.  * MP bus addresses.
  107.  */
  108. #define GIO_TO_MP(x)     (((x) - 0x1f000000) + 0x16400000) /* GIO address is mapped to MP slot 9 */
  109.  
  110. /* Wait for adapter fifo empty (bit set), and gfxdly deasserted (bit cleared) */
  111. #define MG1WAIT \
  112. {        \
  113.     int i = 0;    \
  114.     while ( ((*(volatile long *)(PHYS_TO_K1(MG1_STATUS)) & \
  115.         (MG1_STAT_ADP_FE | MG1_STAT_GFXDLY)) != (MG1_STAT_ADP_FE)) \
  116.         && (i++<1000000)); \
  117.     while ( ((*(volatile long *)(PHYS_TO_K1(MG1_STATUS)) & \
  118.         (MG1_STAT_ADP_FE | MG1_STAT_GFXDLY)) != (MG1_STAT_ADP_FE)) \
  119.         && (i++<1000000)); \
  120.     if (i >= 1000000)        \
  121.         dprintf("MG1WAIT: mg1 status reg:0x%x\n",*(volatile long *)(PHYS_TO_K1(MG1_STATUS))); \
  122. }
  123.  
  124. #define GFXDLYWAIT \
  125. {        \
  126.     int i = 0;    \
  127.     while ( ((*(volatile long *)(PHYS_TO_K1(MG1_STATUS)) & \
  128.         (MG1_STAT_GFXDLY)) != 0) && (i++<1000000)); \
  129.     if (i >= 1000000)        \
  130.         dprintf("GFXDLYWAIT: mg1 status reg:0x%x\n",*(volatile long *)(PHYS_TO_K1(MG1_STATUS))); \
  131. }
  132.  
  133. #define BYPASS_WAIT(bd)    \
  134. {        \
  135.     int i = 0;    \
  136.     while ((((struct mg1_regs *)(bd->adapter_base))->status & MG1_STAT_WRBYP_DONE) && (i++<1000000 )); \
  137.     if (i >= 1000000)        \
  138.         dprintf("BYPASS_WAIT: mg1 status reg:0x%x\n",*(volatile long *)(PHYS_TO_K1(MG1_STATUS))); \
  139. }
  140.  
  141. #endif     /* _KERNEL */
  142.  
  143. #endif /* __SYS_MP_GIO_H__ */
  144.  
  145.  
  146.